package com.example.module_filemanage.MVVM.View.Fragment;

import android.annotation.SuppressLint;
import android.databinding.ViewDataBinding;
import android.graphics.Color;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.example.module_base.Controll.MyToolBar;
import com.example.module_filemanage.Base.FM_BaseFragment;
import com.example.module_filemanage.Public.BodyColor;
import com.example.module_filemanage.R;
import com.example.module_filemanage.Utils.ImageHelper;
import com.example.module_filemanage.Utils.UltimateBar;
import com.example.module_filemanage.databinding.FmShowpictureFragmentBinding;

/**
 * Created by SJ on 2018/4/21.
 */

public class FM_ShowPicture_fragment extends FM_BaseFragment {
    FmShowpictureFragmentBinding mBinding;
    String[] title;
    public static FM_ShowPicture_fragment getInstance(String[] title){
        FM_ShowPicture_fragment _fragment=new FM_ShowPicture_fragment();
        _fragment.setTitle(title);
        return _fragment;
    }
    private void setTitle(String[] title){
        this.title=title;
    }
    @Override
    public int setlayoutid() {
        return R.layout.fm_showpicture_fragment;
    }

    @Override
    public void init(ViewDataBinding binding) {
        mBinding=(FmShowpictureFragmentBinding)binding;
        @SuppressLint("ResourceType") Toolbar toolbar=new MyToolBar(getContext())
                .init().addTitle(title[0],title[1])
                .addLogo()
                .setOverflowIcon()
                .setColor(Color.TRANSPARENT,getResources().getColor(R.color.white))
                .addHome(1, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        getFragmentManager().popBackStack();
                    }
                });

        UltimateBar.newHideBuilder()
                .applyNav(true)     // 是否应用到导航栏
                .build(getActivity())
                .apply();
        this.addToolBar(mBinding.llShowpicture,toolbar,true,false);
        initBody();
        ImageHelper.load(mBinding.imgShow,title[2]);

    }
    private void initBody() {
        mBinding.frameShowpicture.setBackgroundColor(getResources().getColor(BodyColor.maincolor));
    }
    @Override
    public void onDestroy() {
        super.onDestroy();
        UltimateBar.newDrawerBuilder()
                .statusColor(getResources().getColor(R.color.darkslateblue))     // 状态栏颜色
                .statusDepth(0)         // 状态栏颜色深度
                .applyNav(true)         // 是否应用到导航栏
                .navColor(getResources().getColor(R.color.darkslateblue))     // 导航栏颜色
                .navDepth(0)            // 导航栏颜色深度
                .build(getActivity())
                .apply();
    }
}
